---
title: Team Sessions
sidebarTitle: Team Sessions
description: Learn about Team sessions and managing conversation history.
---

When we call `Team.run()`, it creates a stateless, singular Team run.

But what if we want to continue this conversation i.e. have a multi-turn conversation? That's where "Sessions" come in. A session is collection of consecutive runs.

In practice, a session in the context of a Team is a multi-turn conversation between a user and the Team. Using a `session_id`, we can connect the conversation history and state across multiple runs.

See more details in the [Agent Sessions](/concepts/agents/sessions) documentation.

## Multi-user, multi-session Teams

Each user that is interacting with a Team gets a unique set of sessions and you can have multiple users interacting with the same Team at the same time.

Set a `user_id` to connect a user to their sessions with the Team.

In the example below, we set a `session_id` to demo how to have multi-turn conversations with multiple users at the same time.

  ```python
  from agno.team import Team
  from agno.models.openai import OpenAIChat
  from agno.db.sqlite import SqliteDb

  db = SqliteDb(db_file="tmp/data.db")

  team = Team(
      model=OpenAIChat(id="gpt-5-mini"),
      members=[
          Agent(name="Agent 1", role="You answer questions in English"),
          Agent(name="Agent 2", role="You answer questions in Chinese"),
          Agent(name="Agent 3", role="You answer questions in French"),
      ],
      db=db,
      respond_directly=True,
  )

  user_1_id = "user_101"
  user_2_id = "user_102"

  user_1_session_id = "session_101"
  user_2_session_id = "session_102"

  # Start the session with user 1 (This means "how are you?" in French)
  team.print_response(
      "comment ça va?",
      user_id=user_1_id,
      session_id=user_1_session_id,
  )
  # Continue the session with user 1 (This means "tell me a joke" in French)
  team.print_response("Raconte-moi une blague.", user_id=user_1_id, session_id=user_1_session_id)

  # Start the session with user 2
  team.print_response("Tell me about quantum physics.", user_id=user_2_id, session_id=user_2_session_id)
  # Continue the session with user 2
  team.print_response("What is the speed of light?", user_id=user_2_id, session_id=user_2_session_id)

  # Ask the agent to give a summary of the conversation, this will use the history from the previous messages (but only for user 1)
  team.print_response(
      "Give me a summary of our conversation.",
      user_id=user_2_id,
      session_id=user_2_session_id,
  )
  ```

## Conversation history

Teams with storage enabled automatically have access to the run history of the session (also called the "conversation history" or "chat history").

To learn more, see the [Conversation History](/concepts/teams/chat_history) documentation.

## Session Summaries

The Team can store a condensed representations of the session, useful when chat histories gets too long. This is called a "Session Summary" in Agno.

To enable session summaries, set `enable_session_summaries=True` on the `Team`.

```python
from agno.agent import Agent
from agno.team import Team
from agno.models.google.gemini import Gemini
from agno.db.sqlite import SqliteDb

db = SqliteDb(db_file="tmp/data.db")

user_id = "jon_hamm@example.com"
session_id = "1001"

team = Team(
    model=Gemini(id="gemini-2.0-flash-001"),
    members=[
        Agent(name="Agent 1", role="You answer questions in English"),
        Agent(name="Agent 2", role="You answer questions in Chinese"),
    ],
    db=db,
    enable_session_summaries=True,
)

team.print_response(
    "What can you tell me about quantum computing?",
    stream=True,
    user_id=user_id,
    session_id=session_id,
)

team.print_response(
    "I would also like to know about LLMs?",
    stream=True,
    user_id=user_id,
    session_id=session_id
)

session_summary = team.get_session_summary(session_id=session_id)
print(f"Session summary: {session_summary.summary}")
```


### Customize Session Summaries

You can adjust the session summaries by providing a custom `session_summary_prompt` to the `Team`.

The `SessionSummaryManager` class is responsible for handling the model used to create and update session summaries.
You can adjust it to personalize how summaries are created and updated:

```python
from agno.team import Team
from agno.session import SessionSummaryManager
from agno.models.openai import OpenAIChat
from agno.db.sqlite import SqliteDb

# Setup your database
db = SqliteDb(db_file="agno.db")

# Setup your Session Summary Manager, to adjust how summaries are created
session_summary_manager = SessionSummaryManager(
    # Select the model used for session summary creation and updates. If not specified, the agent's model is used by default.
    model=OpenAIChat(id="gpt-5-mini"),
    # You can also overwrite the prompt used for session summary creation
    session_summary_prompt="Create a very succinct summary of the following conversation:",
)

# Now provide the adjusted Memory Manager to your Agent
team = Team(
  members=[],
  db=db,
  session_summary_manager=session_summary_manager,
  enable_session_summaries=True,
)

team.print_response("What is the speed of light?", stream=True)

session_summary = team.get_session_summary()
print(f"Session summary: {session_summary.summary}")
```

See the [Session Summary Manager](/reference/session/summary_manager) reference for more details.

## Control what gets stored in the session

As your sessions grow, you may want to decide what data exactly is persisted. Agno provides three flags to optimize storage while maintaining full functionality during execution:

- **`store_media`** - Controls storage of images, videos, audio, and files
- **`store_tool_messages`** - Controls storage of tool calls and their results  
- **`store_history_messages`** - Controls storage of history messages

<Tip>
### How it works

These flags only affect what gets **persisted to the database**. During execution, all data remains available to your team - media, tool results, and history are still accessible in the `RunOutput` object. The data is scrubbed right before saving to the database.

This means:
- Your team functionality remains unchanged
- Tools can access all data they need during execution
- Only the database storage is optimized
</Tip>



## Developer Resources

- View the [Team schema](/reference/teams/team)
- View the [Session schema](/reference/teams/session)
- View [Cookbook](https://github.com/agno-agi/agno/tree/main/cookbook/teams/session/)